package com.cxf.windex.entity;

import com.cxf.windex.entity.vo.ResourcesPay;
import com.cxf.windex.enums.StatusEnum;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.*;

import lombok.*;
@Table(name = "b_resouces")
@Builder(toBuilder = true)
@AllArgsConstructor(access = AccessLevel.PACKAGE)
@NoArgsConstructor
@Getter
@Setter
public class BResouces {
    /**
     * 资源ID
     */
    @Id
    private Long id;

    /**
     * 真实姓名
     */
    @ApiModelProperty(value = "真实姓名")
    private String realname;

    /**
     * 资源名称
     */
    @ApiModelProperty(value = "资源名称")
    private String name;

    /**
     * 简介
     */
    @ApiModelProperty(value = "简介")
    private String description;

    /**
     * 手机号
     */
    @ApiModelProperty(value = "手机号")
    private String phone;

    /**
     * 用户ID
     */
    @ApiModelProperty(value = "用户ID")
    private String wxopenid;

    /**
     * 微信号
     */
    @ApiModelProperty(value = "微信号")
    private String wx;

    /**
     * 微信头像
     */
    @ApiModelProperty(value = "微信 头像")
    @Column(name = "wx_head_url")
    private String wxHeadUrl;

    /**
     * 地址
     */
    @ApiModelProperty(value = "地址")
    private String address;

    /**
     * 类型，群或者村长
     */
    @ApiModelProperty(value = "类型： 群主或者村长")
    private String type;

    /**
     * 状态 0未认证 1正常
     */
    @ApiModelProperty(value = "状态")
    private String status;

    /**
     * 活跃度
     */
    @ApiModelProperty(value = "活跃度")
    private Integer activity;

    /**
     * 关注度
     */
    @ApiModelProperty(value = "关注 度")
    private Integer attention;

    /**
     * 本周单数
     */
    @ApiModelProperty(value = "本周单数")
    @Column(name = "order_counts")
    private Integer orderCounts;

    /**
     * 经度
     */
    @ApiModelProperty(value = "经度")
    private String latitude;

    /**
     * 纬度
     */
    @ApiModelProperty(value = "纬度")
    private String longitude;

    /**
     * 创建时间
     */
    @Column(name = "crt_time")
    private Date crtTime;

    /**
     * 创建用户IP
     */
    @Column(name = "crt_host")
    private String crtHost;

    /**
     * 更新时间
     */
    @Column(name = "upd_time")
    private Date updTime;

    /**
     * 更新用户IP
     */
    @Column(name = "upd_host")
    private String updHost;

    @ApiModelProperty(value = "省")
    private String  provice;
    @ApiModelProperty(value = "市")
    private String  city;
    @ApiModelProperty(value = "区/县")
    private String  county;

    @ApiModelProperty(value = "乡镇")
    private String  town;

    @ApiModelProperty(value = "证明图片文件")
    private String  files;

    @ApiModelProperty(value = "语音单价(实际到账)")
    @Column(name = "v_price")
    private BigDecimal vPrice;

    @ApiModelProperty(value = "海报单价（实际到账）")
    @Column(name = "l_price")
    private BigDecimal lPrice;

    @ApiModelProperty(value = "支付语音价格(显示)")
    @Column(name = "pay_v_price")
    private BigDecimal payVPrice;

    @ApiModelProperty(value = "支付海报价格（显示）")
    @Column(name = "pay_l_price")
    private BigDecimal payLPrice;

    @ApiModelProperty(value = "客服回复")
    private String replay;

    @Transient
    private  List<BOrdersTask> ordersTasks;

    @Transient
    private String statusDesc;

    @ApiModelProperty(value = "支付信息")
    @Transient
    private ResourcesPay payInfo;

    public void setStatus(String status){
        this.status=status;
        statusDesc=StatusEnum.getIdType(status).getDesc();
    }

    public  void initTaskList(List<ResourcesPay> payList){
        for(ResourcesPay pay:payList){
            if(pay.getResourcesId().equals(this.id)){
                this.payInfo=pay;
            }
        }
    }


}
